import { loadingFadeOut} from 'virtual:app-loading';
import { constantRoutes } from './routes'
import { createRouter, createWebHashHistory } from 'vue-router'


const router = createRouter({
    history: createWebHashHistory(),
    routes: constantRoutes
})

// 路由守卫 - 添加延迟以显示加载动画
router.beforeEach((to, from, next) => {
    // 延迟1.5秒，让加载动画更明显
    setTimeout(() => {
        next()
    }, 1000)
})


router.isReady().then(() => {
    loadingFadeOut()
})

export default router
